﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="volva.Models" %>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h1><%= Html.Encode(ViewData["Message"]) %></h1>
    <div class="frontpagelists">
    
       <div id="showcase">
            <%
                foreach (Video video in ViewData["ShowcaseVideos"] as List<Video>)
                {
                    if (video.thumbnail == null)
                    {
                        video.thumbnail = "/Content/Images/default_thumb.jpg";
                    }
                    Response.Write( "<div class='show'>" + 
		                                "<div class='info'>" + 
			                                "<h2><a href='/Home/Watch/" + video.id + "' title='" + video.name + "'>" + video.name + "</a></h2>" +
			                                "<p><a href='/Home/Watch/" + video.id + "' title='" + video.name + "'>" + video.description + "</a></p>" +
		                                "</div>" +

		                                "<a href='/Home/Watch/" + video.id + "' title='" + video.name + "'><img src='" + video.thumbnail + "' class='showthumb' /></a>" +
	                                "</div>");
                }
                 %>
       </div>
    
    
    <table>
    <caption>Vinsælustu<br /> sjónvarpsstöðvarnar</caption>
    <tbody>

  <%
      int j = 0;
      foreach (Station s in ViewData["MostPopularStations"] as List<Station>)
      {%>
      <tr class="<%= (j % 2 == 0 ? "even" : "odd") %>">
      <td><%
          j++;
          string popularStation = s.name;
          %><a href="/Station/Details/<%= (s.id) %>"><%= (s.name) %></a></td>
      </tr>
    <%  } %>

        </tbody>
       </table>   
       
       <table>
       <caption>Vinsælustu<br /> þættirnir</caption>
       <tbody>
       
       <%
          j = 1;
         foreach (Video v in ViewData["MostPopularVideos"] as List<Video>)
         {
             j++;
             %>
         <tr class="<%= (j % 2 == 0 ? "even" : "odd")  %>">
         <td><%
           string popularVideo = v.name;
             %><%= Html.ActionLink(popularVideo,"Watch/" + v.id)%>
              </td>
         </tr>
        <% } %>
       </tbody>
       </table>
       
       <table>
       <caption>Nýjustu<br /> stöðvarnar</caption>
       <tbody>
       <%
           j = 0;
           foreach (Station s in ViewData["MostRecentStations"] as List<Station>)
         { %>
         <tr class="<%= (j % 2 == 0 ? "even" : "odd") %>">
         <td><%
               j++;
           string recentStation = s.name;
             %><%= Html.ActionLink(recentStation, "Details/" + s.id,"Station")%>
         </td>
         </tr>
       <%} %>
       </tbody>
       </table>
       </div>
       <table width="98%">
       <tr>
       <th><a href="/Station/ListStations/0">Allar stöðvar</a></th>
       </tr>
       </table>       
</asp:Content>



            